package com.epfly.iface.promo.activity.enums;


import com.google.common.collect.Maps;

import java.util.Collection;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 取餐方式:0.不限;1.堂食;2.配送;3.自提
 */
public enum EffectiveTakeMethodsEnum {
    NO_LIMIT((byte) 0, "不限"),
    FOR_HERE((byte) 1, "堂食"),
    DELIVERY((byte) 2, "配送"),
    TAKE_SELF((byte) 3, "自提");


    EffectiveTakeMethodsEnum(Byte key, String value) {
        this.key = key;
        this.value = value;
    }


    private Byte key;

    private String value;

    private static final Map<Byte, EffectiveTakeMethodsEnum> loopUp = Maps.newHashMap();

    static {
        for (EffectiveTakeMethodsEnum value : values()) {
            loopUp.put(value.getKey(), value);
        }
    }

    public static String getValue(Collection<Byte> keyList) {
        return keyList.stream().map(e -> loopUp.get(e).getValue()).collect(Collectors.joining("、"));
    }

    public Byte getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }


}
